//全局提示框
const tips = {
  //文字提示
  toast(title = '', duration = 1500) {
    wx.showToast({
      icon: 'none',
      title: title,
      duration: duration
    })
  },
  //成功提示
  success(title = '', duration = 1500) {
    wx.showToast({
      icon: 'success',
      title: title,
      duration: duration
    })
  },
  //失败提示
  error(title = '', duration = 1500) {
    wx.showToast({
      icon: 'error',
      title: title,
      duration: duration
    })
  },
  //加载提示
  loading(title = '') {
    wx.showLoading({
      title: title,
    })
  },
  //清除提示
  clearToast() {
    wx.hideToast()
  },
  //清除提示
  clearLoading() {
    wx.hideLoading()
  }
}

module.exports = {
  toast: tips.toast,
  success: tips.success,
  error: tips.error,
  loading: tips.loading,
  clearToast: tips.clearToast,
  clearLoading: tips.clearLoading,
}